'
' Copyright (c) 2004-2005
' by Peter Donker ( info@bring2mind.net )
'
' Permission is hereby granted to use and/or modify this software for a single server. It is 
' NOT permitted to publish, distribute, sublicense, and/or sell copies of this software in its
' original or modified form. You are not allowed to remove this copyright notice.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING 
' BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
' NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 
' DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OF THE SOFTWARE.
'
Imports System
Imports System.Data
Imports Bring2mind.DNN.Modules.Guestbook.Data

Namespace Bring2mind.DNN.Modules.Guestbook.Business


#Region "EntriesInfo"
  Public Class EntriesInfo

   ' local property declarations
   Dim _entryId as Integer
   Dim _body as String
   Dim _dateSubmitted as Date
   Dim _email as String
   Dim _isApproved as Boolean
   Dim _moduleId as Integer
   Dim _picture as String
   Dim _userName as String
	
#Region "Constructors"
  Public Sub New()
  End Sub

  Public Sub New(ByVal EntryId As Integer, ByVal Body As String, ByVal DateSubmitted As Date, ByVal Email As String, ByVal IsApproved As Boolean, ByVal ModuleId As Integer, ByVal Picture As String, ByVal UserName As String)
   Me.Body = Body
   Me.DateSubmitted = DateSubmitted
   Me.Email = Email
   Me.EntryId = EntryId
   Me.IsApproved = IsApproved
   Me.ModuleId = ModuleId
   Me.Picture = Picture
   Me.UserName = UserName
  End Sub
#End Region
	
#Region "Public Properties"

  Public Property EntryId() as Integer
   Get
    Return _entryId
   End Get
   Set(ByVal Value as Integer)
    _entryId = Value
   End Set
  End Property

  Public Property Body() as String 
   Get
    Return _body
   End Get
   Set(ByVal Value as String)
    _body = Value
   End Set
  End Property

  Public Property DateSubmitted() as Date 
   Get
    Return _dateSubmitted
   End Get
   Set(ByVal Value as Date)
    _dateSubmitted = Value
   End Set
  End Property

  Public Property Email() as String 
   Get
    Return _email
   End Get
   Set(ByVal Value as String)
    _email = Value
   End Set
  End Property

  Public Property IsApproved() as Boolean 
   Get
    Return _isApproved
   End Get
   Set(ByVal Value as Boolean)
    _isApproved = Value
   End Set
  End Property

  Public Property ModuleId() as Integer 
   Get
    Return _moduleId
   End Get
   Set(ByVal Value as Integer)
    _moduleId = Value
   End Set
  End Property

  Public Property Picture() as String 
   Get
    Return _picture
   End Get
   Set(ByVal Value as String)
    _picture = Value
   End Set
  End Property

  Public Property UserName() as String 
   Get
    Return _userName
   End Get
   Set(ByVal Value as String)
    _userName = Value
   End Set
  End Property

#End Region
 End Class
#End Region
	
#Region "EntriesController"
 Public Class EntriesController
	
 Public Function GetEntries(ByVal EntryId As Integer, ByVal ModuleId as Integer) As EntriesInfo
	
  Return CType(DotNetNuke.Common.Utilities.CBO.FillObject(DataProvider.Instance().GetEntries(EntryId, ModuleId), GetType(EntriesInfo)), EntriesInfo)

 End Function

 Public Function AddEntries(ByVal objEntries As EntriesInfo) As Integer

  Return CType(DataProvider.Instance().AddEntries(objEntries.Body, objEntries.DateSubmitted, objEntries.Email, objEntries.IsApproved, objEntries.ModuleId, objEntries.Picture, objEntries.UserName), Integer)

 End Function

 Public Sub UpdateEntries(ByVal objEntries As EntriesInfo)
	
  DataProvider.Instance().UpdateEntries(objEntries.EntryId, objEntries.Body, objEntries.DateSubmitted, objEntries.Email, objEntries.IsApproved, objEntries.ModuleId, objEntries.Picture, objEntries.UserName)
	
 End Sub

 Public Sub DeleteEntries(ByVal entryId As Integer)
	
  DataProvider.Instance().DeleteEntries(entryId)

 End Sub

  Public Function GetEntriesByModules(ByVal moduleID As Integer , IncludeNonApproved As Boolean) As ArrayList

   Return DotNetNuke.Common.Utilities.CBO.FillCollection(DataProvider.Instance().GetEntriesByModules(moduleID, IncludeNonApproved), GetType(EntriesInfo))

  End Function

 End Class
#End Region


End Namespace
